codechecker icon indicating copy to clipboard operation
codechecker copied to clipboard

WIP Add sanitizer outputs that cause the lsan and asan report-converter to fail

Open jimis opened this issue 3 years ago • 5 comments

The C file was compiled using:

clang-13 -fsanitize=address -fomit-frame-pointer -g lsan2.c

The generated output is incompatible with report-converter, it outputs:

[INFO] - No 'lsan' results can be found in the given code analyzer output.

jimis avatar Feb 25 '22 23:02 jimis

@csordasmarton It seems there are some extra messages and empty lines, in comparison to the existing lsan test, that cause reports from recent versions of leak sanitizer to be incompatible with report-converter.

Even the existing test file lsan.c produces for me output that report-converter can not parse.

Is this a known issue?

jimis avatar Feb 25 '22 23:02 jimis

@jimis No, we didn't have an issue for this problem. I looked into the source code and it looks like the problem comes from here: https://github.com/Ericsson/codechecker/blob/f835d001e51a27cc5674faa31741cd6176cb1cb1/tools/report-converter/codechecker_report_converter/analyzers/sanitizers/parser.py#L136

So if the line contains only white space, we will assume that the report line is ended. Maybe what we can do here is to use the following condition:

        while line and not self.line_re.match(line):

It will break other sanitizer related test cases so we have to fix those test cases too if the solution is good enough.

csordasmarton avatar Feb 28 '22 13:02 csordasmarton

Thanks @csordasmarton. I already tried something similar and I'm afraid it's not that simple.

When you have more than one leak reported (see the file lsan2.out), the 2nd (and onwards) error message is printed without an ERROR|WARNING prefix and then the stack trace follows. I'm not sure how to catch that with a regex. Maybe a complex multi-line regex is possible?

jimis avatar Feb 28 '22 14:02 jimis

No, we didn't have an issue for this problem

Filed #3617 to keep track of the issue.

jimis avatar Mar 02 '22 15:03 jimis

I added a bunch of outputs for ASAN too, to show that a lot of important information is missed by report-converter. In particular only the first stacktrace after ==ERROR is recorded, all the rest is thrown away.

jimis avatar Mar 29 '22 18:03 jimis