8000 [analyzer] Fix crash when an assembler command is analyzed by bruntib · Pull Request #3914 · Ericsson/codechecker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[analyzer] Fix crash when an assembler command is analyzed #3914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2023

Conversation

bruntib
Copy link
Contributor
@bruntib bruntib commented May 18, 2023

If an assember command is analyzed then the recognized language remains None which can't be provided after -x flag in a subprocess.Popen call. So -x is added to the command if the recognized language is not None.

Fixes #3670
Fixes #3730

@bruntib bruntib added CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands analyzer 📈 Related to the analyze commands (analysis driver) labels May 18, 2023
@bruntib bruntib added this to the release 6.22.2 milestone May 18, 2023
@bruntib bruntib requested a review from Szelethus May 18, 2023 13:42
@bruntib bruntib requested a review from vodorok as a code owner May 18, 2023 13:42
@nolange
Copy link
nolange commented May 18, 2023

I am not sure if GCC would give you useful output without specifying language.
Wouldn't it be better to just skip files that aren't supported?

@bruntib
Copy link
Contributor Author
bruntib commented May 18, 2023

If -x is not provided then GCC determines the language based on the source file's extension among others. So I think that a list of implicit include paths are still printed even if -x is missing from the gcc command.

I'm a little worried, that if we skip the entire build action, just because we can't recognize the language due to some other potential bug then the analysis of that file would be silently skipped, even though the file could be analyzed anyways without -x.

What do you think?

@nolange
Copy link
nolange commented May 18, 2023

In this case it is nasm that is called, not GCC, and it is called without any file.

I believe you are trying to find out default include paths here, how does that work - all unsupported Extension map map to none, first one gets called even if it is not GCC and you can't even parse the output?

As for what I would be doing, for default includes stick to the languages (compilers?) you know, skip the rest.
Maybe extend the list of known languages that are supported with -x.

@whisperity
Copy link
Contributor

@bruntib Could you please check if this also fixes #3730? The two issues sound similar following a superficial read.

@bruntib bruntib force-pushed the asm_action_crash branch from b401e45 to 3c29af0 Compare May 19, 2023 12:05
@bruntib
Copy link
Contributor Author
bruntib commented May 19, 2023

@nolange I created another implementation which doesn't call the implicit include path collector if the language is not recognized. The build action itself is skipped in this case even today, so only this crash should be eliminated.

if not action.lang:
continue

@whisperity Yes, it fixes that ticket too. I added it to the commit message.

If an assember command is analyzed then the recognized language remains
None which can't be provided after -x flag in a subprocess.Popen call.
So -x is added to the command if the recognized language is not None.

Fixes Ericsson#3670
Fixes Ericsson#3730
@bruntib bruntib force-pushed the asm_action_crash branch from 3c29af0 to 322268a Compare May 19, 2023 12:11
Copy link
Contributor
@vodorok vodorok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small question

'directory': ''}

res = log_parser.parse_options(action)
print(res)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this print necessary?

@bruntib
Copy link
Contributor Author
bruntib commented May 25, 2023
8000

I just copy-pasted it from the other test cases. I don't know.

Copy link
Contributor
@vodorok vodorok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vodorok vodorok merged commit 363a533 into Ericsson:master May 25, 2023
@bruntib bruntib deleted the asm_action_crash branch May 26, 2023 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 📈 Related to the analyze commands (analysis driver) CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands
Projects
None yet
4 participants
0