-
Notifications
You must be signed in to change notification settings - Fork 20
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
add --gcc-analyzer-bin
option to gcc plug-in
#41
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think this could really work without updating props.env["CSGCCA_ANALYZER_BIN"]
. Minor review comments inline...
I deleted it by accident. Should work as intended now. I'm sorry for the confusion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! Unfortunately, it does not work as expected. If a direct absolute path to the DTS gcc binary is given to --gcc-analyzer-bin
, gcc is not invoked through cswarp
, which is otherwise responsible for capturing the diagnostic output. A few review comments inline...
This helped me to make it actually work:
If this is the way to go, we need to figure out how to provide the functionality through a user-friendly and flexible enough interface... |
The solution which came to me is to inject I.e. The limitation created by this solution would be that binary has to be named Also per my understanding in execution branch where analyzer is actually executed, we don't expect the system compiler to be executed in the future, so every process that reached the point to execute analyzer can safely mask all traces of the system compiler in the PATH variable. |
|
-fixes after review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
CSMOCK_GCC_WRAPPER_NAME
needs to be appended to ${CSWRAP_TIMEOUT_FOR}
in order to keep the --cswrap-timeout
option of csmock working. Two minor remarks inline.
Thanks for the update! It seems to work as expected now. I have added just three comments to explain how --- a/py/plugins/gcc.py
+++ b/py/plugins/gcc.py
@@ -185,27 +185,30 @@ class Plugin:
results.error("`%s -fanalyzer` does not seem to work, "
"disabling the tool" % analyzer_bin, ec=0)
return 0
if args.gcc_analyzer_bin:
+ # create an executable shell script to wrap the custom gcc binary
wrapper_script = CSMOCK_GCC_WRAPPER_TEMPLATE % analyzer_bin
cmd = "echo '%s' > %s && chmod 755 %s" % \
(wrapper_script,
CSMOCK_GCC_WRAPPER_PATH,
CSMOCK_GCC_WRAPPER_PATH)
rv = mock.exec_chroot_cmd(cmd)
if 0 != rv:
results.error("failed to create csmock gcc wrapper script")
return rv
+ # wrap the shell script by cswrap to capture output of `gcc -fanalyzer`
cmd = "ln -sf ../../bin/cswrap %s/%s" % \
(props.cswrap_path, CSMOCK_GCC_WRAPPER_NAME)
rv = mock.exec_chroot_cmd(cmd)
if 0 != rv:
results.error("failed to create csmock gcc wrapper symlink")
return rv
+ # tell csgcca to use the wrapped script rather than system gcc analyzer
props.env["CSGCCA_ANALYZER_BIN"] = CSMOCK_GCC_WRAPPER_NAME
# XXX: changing props this way is extremely fragile
# insert csgcca right before cswrap to avoid chaining
# csclng/cscppc while invoking `gcc -fanalyzer` Let's merge this as it is and continue with the development via separate pull requests. |
--gcc-analyzer-bin
option to gcc plug-in
... to specify a custom build of gcc to be used for `gcc -fanalyzer` Closes: csutils#41
No description provided.