cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE 1.13.2: cyclomatic complexity reports all C++ as dead code

0x0BADCODE
Associate

I tried to analyze our mixed C/C++ STM32F4xx project, but all functions in *.cpp sources including "main()" are not shown by default, until I deactivated the "hide dead code" checkbox.

ST,

could you please confirm the bug in new Cyclomatic Complexity tool?

Hiding unlinked code would be useful indeed, if all actually called C++ functions would be reported correctly.

3 REPLIES 3
Semer CHERNI
ST Employee

Hello @0x0BADCODE 

First let me thank you for posting and apologize for the late reply.

I made a test and I'm not able to reproduce the described behavior.

Could you provide some code snip which help the see the issue?

KR,
Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

0x0BADCODE
Associate

Hello Semer,

I just noticed today that the Cyclomatic Complexity window is empty - until I actually connect the target with Debugger (which is a bit surprising as I would expect the CC is a kind of static analysis tool, so having ELF image on host PC should be sufficient to track unused code, etc.).

So back to your question: if you cannot reproduce the behavior - it is not about a specific "code snip" but the debug configuration. In my case I use Segger JLink Plus or also Segger OB reflashed on Nucleo board. Moreover, with  debugger and Breakpoint set on RESET vector, the CC window is initially empty until the C main() is reached, then the C functions appear in the CC list but none of the C++... Hope this helps.

Hello @0x0BADCODE 

"I just noticed today that the Cyclomatic Complexity window is empty - until I actually connect the target with Debugger (which is a bit surprising as I would expect the CC is a kind of static analysis tool, so having ELF image on host PC should be sufficient to track unused code, etc.)."

> You are right only the elf file is needed for the feature to function and it's unusual to see the described behavior.

However, about the original question, after further test I see what you are talking about. Initially I misunderstood the question. I thought you talk about function declared with extern "C"  not the class methods.
I fact I imported a CPP project I found that methods declared in a class will not be shown unless the "Hide dead code" is ticked.
I will escalade this question internally and go back to you with an answer ASAP.

KR,
Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.