Hi,
I’m trying to use the code inspection tool for my ESP32 code. I created a simple test with some obvious errors that I thought should be caught. The problem is the inspection tool doesn’t return the visual information that I see in most examples for the tool. It just returns a long list of text and doesn’t seem to find any problem with my code.
void setup()
{
int *x = (int*)malloc(10);
free(x);
free(x);
*x = 123;
}
This is the screen that I get:
When I inspect the whole message by using the CLI and executing pio check
it has
Error: Found a breaking defect 'syntax error' in C:\Users\Max\.platformio\packages\toolchain-xtensa32@2.50200.97\xtensa-esp32-elf\include\c++\5.2.0\bits\random.h:69
Please note: check results might not be valid!
Try adding --skip-packages
at the end.
When I execute pio check --skip-packages
I get
So it catches the double-free and dereference-freed-pointer issues.
It’s a known error that cppcheck
just dies when analyzing some toolchain or SDK files (see e.g. cppcheck code inspect fails on samd boards · Issue #3951 · platformio/platformio-core · GitHub)
--skip-packages
works around that by not telling it to do that.
Thanks, I get the same result now.
This can only be run by CLI? Is there an option to add --skip-packages to the visual inspector?
Thanks.
This setting is not exposed UI as far as I know. I’ve opened an issue for that here.