|
From: Florian K. <br...@ac...> - 2008-06-17 16:24:32
|
On Monday 16 June 2008 10:17:54 am omo wrote: > Hello, > > I've prototyped a simple fault injector for malloc()-like routines, > called "Failgrind". > The tool can make fail malloc() and its variants which are called from > specific functions. > the basic idea is similar to the bug: > http://bugs.kde.org/show_bug.cgi?id=163266 > and failmalloc http://www.nongnu.org/failmalloc/ . > > This is just a small, proof-of-concept prototype, and there will be a > lot of TODOs. > Which is better to the patch to massif or current "separate tool" style? > What are missing features? How should they be implemented? > How to intercept specific functions? > Does this type of tool make sense at all? > This would be a very useful tool to have. And you already got a great name for it.. As the bugzilla entry suggests it would be good to not restrict it to just malloc etc. failures. File system failures, temporary network unavailability and other such things that are difficult to test otherwise could be emulated nicely this way. The hard part will be how to control where you want to insert the failure. This could be something as John has suggested. More difficult control mechanisms could include - make function foo in "bar.c", line 100 fail (whenever it is reached) - make some function fail only in a particular calling context - restrict failures to functions in a given DSO and so on. Valgrind provides a way to wrap/replace functions. Described here http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.wrapping This might be useful in case you want to extend the tool beyond handling malloc and friends. Florian |