|
From: Lukasz M. <luk...@gm...> - 2015-06-26 01:19:38
Attachments:
valgrind.diff
example.c
|
Hi, For some time I wanted to write valgrdind tool that tracks "resources". It is something you mention on webpage as a proposal. I made some initial implementation, it has hardcoded functions, but about it later. I assumed the tracked API is like this: token = create_resource() retain_resource(token) retain_resource(token) ... ... release_resource(token) release_resource(token) So, there is alloc function(s). Resource can be retained and released by token provided by allocator. Even this implementation allow multiple allocators retainers and releasers, but it is not my point for now. For now I have 2 questions, I hope you don't mind, they may seem trivial for you, but can't find answer myself. 1. does result of VG_(record_ExeContext) have to be freed in some way? 2. is there way to check if valgrind's tool have some leaks? Running valgrind under valgrind? :) The implemntation I'm sending has hardcoded functions: create_resource retain_resource release_resource I'm Ok, to customize this implementation to my real need, but perfectly it should be configurable by config file. I have just doubts how it should work eventually. You say on you webside, there should be no wrappers, that mismatch original function signature not match everything. At valgrind compilation time there is not way to know function's signature nor it's arguments that user want to track. I assume there is a config file, that describes rules containing allocator, deallocators, etc... I have just an idea to create parser that creates *.c file basing on config and valgrind compiles it and dlopen in preloaded library. In attached implementation I made almost all necessary stuff. Preloaded library would wrap main function and do all stuff to initialize analyzing. It attached implementation preloaded library wraps example functions, in final version where would only be a wrapper for main that loads user provided library/config. My question is: do you have better solution for this? Do not do major review of attached patch, it is still work in progress, I just want consult an idea. Best Regards, Lukasz Marek |
|
From: Philippe W. <phi...@sk...> - 2015-07-01 08:03:04
|
On Fri, 2015-06-26 at 03:19 +0200, Lukasz Marek wrote: > For now I have 2 questions, I hope you don't mind, they may seem trivial > for you, but can't find answer myself. > 1. does result of VG_(record_ExeContext) have to be freed in some way? No, once created, exe context are 'permanent'. > 2. is there way to check if valgrind's tool have some leaks? Running > valgrind under valgrind? :) Yes, see README_DEVELOPERS, section Self-hosting Philippe |
|
From: Florian K. <fl...@ei...> - 2015-08-31 20:57:41
|
On 26.06.2015 03:19, Lukasz Marek wrote: > Hi, > > For some time I wanted to write valgrdind tool that tracks "resources". > It is something you mention on webpage as a proposal. Yes, a generalised resource checker would be quite useful to have. If you're serious about it, open a bug in bugzilla, explain what your plans are and add any patches there as well. Patches sent to the mailing list typically get forgotten about. Bugzilla is here: http://valgrind.org/support/bug_reports.html > > For now I have 2 questions, I hope you don't mind, they may seem trivial > for you, but can't find answer myself. > 1. does result of VG_(record_ExeContext) have to be freed in some way? No. It does not look like it. > 2. is there way to check if valgrind's tool have some leaks? Running > valgrind under valgrind? :) Yes. Look at README_DEVELOPERS and read the section about Self-hosting. Florian |