Feature #865
closedAspectator: Support for reusable blocks of aspect files
0%
Description
Aspectator should support something like #include directives in aspect files.
It is required for kernel model and other aspects that are common for several rules.
For example, see a fix for bug #749.
Files
Updated by Evgeny Novikov almost 14 years ago
- Status changed from New to Open
It would be great! But after update aspectator up to the new gcc with ldv pretty printer.
Updated by Alexey Khoroshilov over 13 years ago
- Priority changed from Normal to High
Another example is to share code that matches same kernel functions (e.g. spinlock or memory functions) between several rules/rule models.
Updated by Evgeny Novikov over 12 years ago
Don't forget to extract IS_ERR model from 101_1a rule model (issue #2707).
Updated by Evgeny Novikov over 12 years ago
- Priority changed from Normal to High
The issue becomes more priority, since we're going to use aspectator more and more actively.
Updated by Evgeny Novikov over 12 years ago
Hmm, I guess that using of the standard GCC preprocessor is very suitable for this issue.
Aspect defines are coming soon :)
Updated by Alexey Khoroshilov over 12 years ago
Evgeny Novikov wrote:
Hmm, I guess that using of the standard GCC preprocessor is very suitable for this issue.
Aspect defines are coming soon :)
I am not sure that standard GCC preprocessor is good enough. For example, it will apply and remove #define statements that is not expected at this stage.
Updated by Evgeny Novikov over 12 years ago
Alexey Khoroshilov wrote:
Evgeny Novikov wrote:
Hmm, I guess that using of the standard GCC preprocessor is very suitable for this issue.
Aspect defines are coming soon :)I am not sure that standard GCC preprocessor is good enough. For example, it will apply and remove #define statements that is not expected at this stage.
Yes, I have tested the standard preprocessor just on aspects that don't insert defines and includes. But nevertheless, I guess, that it should be used. So, I can teach the "standard" preprocessor to deal with $define and $include directives instead of #define and #include respectively.
Updated by Evgeny Novikov over 12 years ago
- Status changed from Open to Resolved
- @include
- @define
(I had to to use '@' instead of '$' to avoid conflicts with advice body patterns (like $argN, $ret_type, etc.))
This is rather considerable feature. So, I'm going to test it (especially with including of kernel function model of #2707) and merge to master.
At best neither this feature nor fixes of #2760 and #2954 shouldn't affect the standard workflow anyway.
Updated by Evgeny Novikov over 12 years ago
- @ifdef
- @endif
They work well.
Updated by Evgeny Novikov over 12 years ago
- File built_in_macros built_in_macros added
- Status changed from Resolved to Open
There is at least one lack in the current implementation. For instance, when there is:
#include <linux/blkdev.h>
in some aspect file, it's treated during aspect preprocessing as:
@include <linux/blkdev.h>
But this is affected by the standard built-in macro:
#define linux 1
that leads after all to an incorrect file name at other stages:
#include <1/blkdev.h>
I guess that the simplest workaround (but not universal, unfortunately) is to make explicit undefines of some standard built-in macros just at the aspectator preprocessing stage. I attached the full list of such built-in macros obtained on my machine. I think that just 'linux' and 'unix' macros may appear in path names. So I'll disable just these definitions.
Updated by Evgeny Novikov over 12 years ago
One more lack is that model comments are removed during aspect preprocessing, but it has a simple fix: just add at the aspect preprocessing stage, option -C, that keeps comments.
Updated by Alexey Khoroshilov over 12 years ago
Is it possible to turn off all built-in macros?
Updated by Evgeny Novikov over 12 years ago
Alexey Khoroshilov wrote:
Is it possible to turn off all built-in macros?
After all, I have found a special option (http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Preprocessor-Options.html):
-undef Do not predefine any system-specific macros. The common predefined macros remain defined.
This option turns off almost all built-in macros except:
#define __STDC__ 1 #define __STDC_HOSTED__ 1
STDC_HOSTED cannot be turned off without GCC modification, but I guess that these two macros will not affect aspects. Just if somebody will use them in code, they will be expanded at the aspect preprocessing stage, but this isn't so bad.
Updated by Evgeny Novikov over 12 years ago
- Status changed from Open to Resolved
728e37f commit of feature-2958 fixed the issue. It's being tested and will be merged to master.
Updated by Evgeny Novikov over 12 years ago
- Published in build set to 7775bfe
Merged to the master branch in commit 7775bfe.
Updated by Evgeny Novikov over 12 years ago
a18d35b of the master branch extracted a common Linux error processing model to a separate aspect (issue #2707).
Updated by Evgeny Novikov over 12 years ago
QA successfully tested this commit. Alexey, close this feature if you find it to be well enough.
Updated by Alexey Khoroshilov over 12 years ago
I would prefer to have something like demo for a set of newly implemented aspectator related features to inform all about them and to get more wide feedback.
Updated by Evgeny Novikov over 12 years ago
- Status changed from Resolved to Open
More one problem was found by night tests: during aspect preprocessing '\'s are eliminated from aspects. This makes gcc unhappy, when there is such the construction is used in aspects:
#define LDV_CHECK_AND_INCREASE(state, value) ldv_assert(state == value); \ state++;
Updated by Evgeny Novikov over 12 years ago
- Status changed from Open to Resolved
- Published in build changed from 7775bfe to 41718a0
Commit 41718a0 of the master branch fixed the issue in the following manner: it ignores all backslashes encountered in aspects. Because of this we cannot use backslashes in aspect defines, but still can use them in other cases. QA is running small tests now, big tests will be run at night.
Updated by Evgeny Novikov over 12 years ago
- Status changed from Resolved to Open
- Priority changed from High to Urgent
More one issue was found by Denis Efremov. It turns out, that during aspect preprocessing modified preprocessor is called with options intended for a corresponding driver file compilation (preprocessing). This is totally incorrect since there may be such options that do not depend on presence of '#' directives and may affect on preprocessing. For instance:
-D name=definition The contents of definition are tokenized and processed as if they appeared during translation phase three in a `#define' directive. In particular, the definition will be truncated by embedded newline characters. ... -include file Process file as if #include "file" appeared as the first line of the primary source file. However, the first directory searched for file is the preprocessor's working directory instead of the directory containing the main source file. If not found there, it is searched for in the remainder of the #include "..." search chain as normal. If multiple -include options are given, the files are included in the order they appear on the command line.
Obvious fix is to call the modified preprocessor without options that come from drivers compilation. I don't know why we didn't catch this issue before...
Updated by Evgeny Novikov over 12 years ago
- Status changed from Open to Resolved
- Published in build changed from 41718a0 to 983ce20
Commit 983ce20 of the master branch should fix the given issue. Wait for QA will test this commit.
Updated by Evgeny Novikov over 12 years ago
Let's wait for today night test results.
Updated by Evgeny Novikov over 12 years ago
- Status changed from Resolved to Open
Again one more issue related! We use a hack to process typedefs at the beginning of function signatures, like:
around: call(#bool func(..)) { ... }
But at present a line after '#' is considered as a special preprocessor line. In fact those lines can be placed just at the beginning of lines, so we can distinguish them. But it's a workaround since one can write:
around: call( #bool func(..) ) { ... }
that also will lead to fail since line after '#' will be removed.
So, I guess to use an another character for the hack, e.g. '^':
around: call(^bool func(..)) { ... }
Updated by Evgeny Novikov over 12 years ago
- Status changed from Open to Resolved
- Published in build changed from 983ce20 to c371769
The given issue was fixed in commit c371769 of the master branch that is tested now.
Updated by Evgeny Novikov over 12 years ago
I think, that we should close this issue, since it works rather stable. But I remember that after all I have to present all new features of aspect development.
Updated by Evgeny Novikov about 12 years ago
- Project changed from Linux Driver Verification to C Instrumentation Framework
- Category deleted (
15)
Updated by Evgeny Novikov over 11 years ago
- Priority changed from Urgent to High
Should be closed at last.
Updated by Evgeny Novikov over 10 years ago
- Status changed from Resolved to Closed
Close since there was not any objections.