Don't log linking build actions by default.#1450
Conversation
| return 0; | ||
| } | ||
|
|
||
| int isObjectFile(const char* filename) |
There was a problem hiding this comment.
Parameter names should end with underscore: filename_
| { | ||
| size_t i; | ||
| for (i = 0; i < vec_->size; ++i) | ||
| { |
There was a problem hiding this comment.
I think you should remove the blocks from here and below.
| LoggerCmpFuc cmp_); | ||
|
|
||
| /** | ||
| * Funds an elemnt using the given predicate fuction. |
| * | ||
| * @param vec_ a vector struct (must be not NULL). | ||
| * @param pred_ a predicate function. | ||
| * @return SIZE_MAX if the element not found otherwise the item`s index |
There was a problem hiding this comment.
Mark the end of the sentence with dot: ..
libcodechecker/log/build_manager.py
Outdated
| if 'CC_LOGGER_GCC_LIKE' not in log_env: | ||
| log_env['CC_LOGGER_GCC_LIKE'] = 'gcc:g++:clang:clang++:cc:c++' | ||
| if keep_link or ('CC_LOGGER_KEEP_LINK' in log_env and | ||
| log_env['CC_LOGGER_KEEP_LINK'] == 'true'): |
There was a problem hiding this comment.
Is it necessary to check this condition. If it is true we set it to true?
|
How is executing |
gyorb
left a comment
There was a problem hiding this comment.
Please update the feature based on the discussion. In the issue.
|
@whisperity the idea is that two separate json files will be generated (compilation, linking). If we can not decide right now if it is a linking only action I would still add it to the compilation actions, so we wont loose files which should be analyzed. |
|
I'm in trouble a bit how this should be implemented. The goal was to omit linking actions from the compilation database, because these are
On the other hand if we want to save them then the decision was to place them in another file (#1436). This doesn't fit in the current implementation of the build logger, since it is a general C/C++/Java logger, the log collector part can't distinguish between compilation and linking. And the linking actions can't be skipped in CodeChecker, because it's too late (see item 2.) |
|
In case CTU ever attempts to go beyond considering an ambiguous function call due to multiple implementations in the mangled name map as Until then, it looks safe enough to omit, as nothing currently understands them in any useful manner. |
|
If I am taking it correctly the problem with too big JSONs is that we first load the entire JSON array into the memory and then try to iterate on it. Could this be changed into a more dynamic, stream like approach, where the JSON is processed without it being fully loaded at any given time, and thus we can manually ignore link commands and only store build actions in the memory that are relevant? (Or perhaps store even less in memory!) |
|
I don't really understand @bruntib's 3rd concern here.
In this pull request you distinguish between linker and compliation
commands based on the extension of the source file. Isn't this good enough?
Why can't you log always linking actions to linking_actions.json and keep
only compilation commands in compile_commands.json?
So I suggest removing CC_LOGGER_KEEP_LINK env var from ldlogger-tool-gcc.c
<https://github.com/Ericsson/codechecker/pull/1450/files#diff-a111e62f6311348903e2dbb2cb1e1a91>
and remove --keep-link parameter from codechecker.
BTW compilation database format specification is described here
https://clang.llvm.org/docs/JSONCompilationDatabase.html
with this definition:
"A compilation database is a JSON file, which consist of an array of
“command objects”, where each command object specifies one way a
translation unit is compiled in the project. "
Stream processin of compila_commands.json is a good idea besides this PR.
…On Fri, Mar 16, 2018 at 11:48 PM, Whisperity ***@***.***> wrote:
If I am taking it correctly the problem with too big JSONs is that we
first load the entire JSON array into the memory and then try to iterate on
it.
Could this be changed into a more dynamic, stream like approach, where the
JSON is processed without it being fully loaded at any given time, and thus
we can manually ignore link commands and only store build actions in the
memory that are relevant? (Or perhaps store even less in memory!)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1450 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHqK6WV9iznP3dQjFPRi4JdqWgb0auX8ks5tfEFOgaJpZM4SmVjw>
.
|
|
@dkrupp It is not always trivial if a compile command is a simple compile command or also a link command. You are in luck with CMake as it, in most cases, generates separate compile and link commands (then again, CMake can also natively export a CCDB, so there is no reason to log the build at all), but older/custom/different systems can end up having their build logged like this: This is a compile and a link command. So the logger tool must either be able to see the |
|
In case we are not afraid of adding additional dependencies, there are som libraries for lazy json parsing which we could try: I think it is a good idea to both remove linking commands and make handling of potentially large files lazy. |
|
My problem was not related to distinction of linking and compilation commands. The problem is that the only .json output file has to be given to the So for now I extend the build logger so it can be able to write two output files. The details can be specified later. |
|
For now we can always say that in case of Java, the link command list will be empty, because Java always does dynamic linking and classloads. 😬 (Not that anyone would actively be using the ld-logger anyways.) |
The logger can be given a flag if the user wants to keep the linking actions in the compilation database.
dkrupp
left a comment
There was a problem hiding this comment.
Verified on xerces with or without logging linking.
compile_commands_with_linking.json 8.7MB
compile_commands_no_linking.json 447KB
impressive decrease!
Number of build actions analyzed 631 in both cases.
Looks good to me.
The logger can be given a flag if the user wants to keep the linking
actions in the compilation database.