Feature #3692
openAdd ability to get information on structure variable initialization
0%
Description
static struct usb_driver karma_driver = {
.name = "ums-karma",
.probe = karma_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.resume = usb_stor_resume,
.reset_resume = usb_stor_reset_resume,
.pre_reset = usb_stor_pre_reset,
.post_reset = usb_stor_post_reset,
.id_table = karma_usb_ids,
.soft_unbind = 1,
.no_dynamic_id = 1,
};
we would like to obtain following information:
- "usb_driver" - structure name.
- "karma_driver" - variable name.
- "probe - karma_probe", ..., "post_reset - usb_stor_post_reset" - pairs of field name and function name (strings, numbers, variable names and so on are of no interest).
Files
Updated by Evgeny Novikov over 11 years ago
- File test9.c test9.c added
- File test9.aspect test9.aspect added
- File file file added
- Tracker changed from Bug to Feature
- Status changed from Open to Feedback
First version of this feature is available in commit 693bb78 of feature-3692 branch pushed to Aspectator submodule. You can consider results (file file) obtained for file test9.c and aspect test9.aspect as output format specification. Note that initialization of arrays of structures isn't supported still.
Updated by Ilja Zakharov over 11 years ago
- File problems_acpi.tar.gz problems_acpi.tar.gz added
- File problems_drbd.tar.gz problems_drbd.tar.gz added
The following bugs occur while using this inforequest. More details in attachments.
Updated by Evgeny Novikov over 11 years ago
As for acpi, there turns out to be an array field name in acpi_driver structure. Beginning from commit 716a543 in feature-3692 branch information on it is printed in such the form:
Field name is 'name' Field type is 'array' Field declaration is 'char %s[80]' Field value is '"processor_aggregator"'
As for drbd, unsupported array elements initialization was found:
struct dma_attrs attrs = { .flags = { [0 ... (((DMA_ATTR_MAX) + (8 * sizeof(long)) - 1) / (8 * sizeof(long)))-1] = 0 }, };
Updated by Evgeny Novikov over 11 years ago
- File test9.c test9.c added
- File test9.aspect test9.aspect added
- File file file added
Beginning from commit 00b8e7f in feature-3692 branch of Aspectator submodule initialization of simple/pointer/array variables is also supported. Also one can use "$" instead of array size in pointcuts to match arrays of any size.
These features required considerable changes in format, sorry for that. You can see new "specification" in attached files. I hope that they won't be changed so much in future.
BTW, drbd is processed well now.
Updated by Evgeny Novikov over 11 years ago
- Status changed from Feedback to Resolved
- Published in build set to e28f037
Added in commit e28f037 of the master branch of LDV tools, in e0b4bea of CIF submodule and in commit bfe8a89 of Aspectator submodule.
Wait for night tests and reference launch results before closing.
Updated by Evgeny Novikov over 11 years ago
- Status changed from Resolved to Closed
Works fine for small and night regression tests as well as with reference launches for 32_7a rule model.
Updated by Evgeny Novikov over 10 years ago
- File ipmi_poweroff.c.macroinstrumented.xz ipmi_poweroff.c.macroinstrumented.xz added
- File first_request.aspect.xz first_request.aspect.xz added
- File first_request.answer.xz first_request.answer.xz added
- Status changed from Closed to Open
One unpleasant issue was discovered. If a function pointer is assigned to a structure field but a type of this structure field doesn't coincide with a type of the given function, then the compiler makes an explicit cast on assignment. When we try to call functions together with these casts the compiler inserts __builtin_trap instead these calls, that eventually causes failures.
To reproduce this you need to run (CIF before 63912d):
$(CIF) --aspect first_request.aspect --in ipmi_poweroff.c.macroinstrumented --out out --stage instrumentation
and then you can see in first_request.answer:
Structure field initialization Field name is 'set' Type is 'function pointer' Declaration is 'int (*%s)(char const *, struct kernel_param const *)' Pointed function return type declaration is 'int %s' Pointed function argument type declarations are 'char const *%s', 'struct kernel_param const *%s' Value is '( int (*)(char const *, struct kernel_param const *)) & set_param_ifnum'
Although these issues are issues in drivers and thus should be fixed there, we can't wait when this will be done. And sometimes that mechanism is used intentionally, e.g. to assign pointers to stub functions. The compiler doesn't complain about that.
I am going to implement a workaround - will disable printing of casts in corresponding cases. No regexps!
Updated by Evgeny Novikov over 10 years ago
- Status changed from Open to Feedback
Fixed in the feature-3692 branch of the Aspectator submodule. The workaround touches, by the way, all other implicit/explicit casts as well. This should simplify parsing of source code querying answers, but may be a source of other issues. So, I am looking forward for a feedback from Ilja. For instance, regressions for all modules for one rule specifications and for modules subjected to the given issue for other rule specifications.
Updated by Ilja Zakharov over 10 years ago
Application of the workaround during 3.13-rc1 kernel verification showed that in general benchmark was successful, but several problems occured. For instance, in case of function with void argument I got "error: too many arguments":
static enum xp_retval xpc_notloaded(void)
This function is used as follows:
struct xpc_interface xpc_interface = {
(void ()(int))xpc_notloaded,
(void ()(int))xpc_notloaded,
(enum xp_retval()(short, int, u32, void *, u16))xpc_notloaded,
(enum xp_retval()(short, int, u32, void , u16, xpc_notify_func,
void *))xpc_notloaded,
(void ()(short, int, void ))xpc_notloaded,
(enum xp_retval()(short, void *))xpc_notloaded
};
EXPORT_SYMBOL_GPL(xpc_interface);
DEG generates code according to structure fields:
(& xpc_notloaded)(ldvarg18);
...
(& xpc_notloaded)(ldvarg15,ldvarg17,ldvarg16);
Less than a dozen of modules failed because of the reason.
Updated by Evgeny Novikov over 10 years ago
- Status changed from Feedback to Open
- Priority changed from High to Normal
Reduce priority due to major issues were gone.
Updated by Evgeny Novikov over 8 years ago
- Category set to Weaving
- Priority changed from Normal to High