https://bugs.kde.org/show_bug.cgi?id=396290

            Bug ID: 396290
           Summary: [PATCH] Possible tool - allocfail
           Product: valgrind
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: roger.li...@cedalo.com
  Target Milestone: ---

Created attachment 113820
  --> https://bugs.kde.org/attachment.cgi?id=113820&action=edit
Patch against master

Hello,

I've done some work on making a valgrind tool to help test heap allocation
failures. The idea is that when an allocation is about to happen, the tool
checks whether it has seen this call stack before. If it hasn't seen the call
stack, then the memory allocation fails, otherwise it succeeds. Call stacks are
stored in memory and on disk in the form of a checksum, and each time the tool
runs it can load the checksums from disk so carrying out multiple runs of the
same program will test different allocation failures.

In theory this means you can test the failure of every single heap allocation
in your program, in practice that may be difficult to achieve, especially for
complex programs.

I've attached the patch for your consideration. The biggest limitation to my
mind is the use of the adler32 checksum function. Ideally I would use an actual
hashing function and have a version of this patch that uses a third party sha3
implementation, but didn't want to complicate things at this point. I have't
managed to get print-docs working, but I believe that is more down to my
environment than anything else.

I look forward to your comments...

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to